package com.bmts.gtmc.xls;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 加载Properties文件
 * @author yanghaoquan
 *
 */
public class ProUtil {
	
	private static Log log = LogFactory.getLog(ProUtil.class) ;
	
	private static Properties pros = System.getProperties() ;
	
	private ProUtil() {}
	
	static {
		try {
			String path = System.getProperty("user.dir")+"/config.properties" ;
			InputStream is = new FileInputStream(path) ;
			pros.load(is) ;
			is.close() ;
			log.info("加载配置文件：" + path) ;
		} catch (IOException e) {
			log.info("配置文件加载错误：" + e.getMessage()) ;
		}
	}
	
	public static String getBean(String key) {
		return pros.getProperty(key) ;
	}
	
	public static void main(String[] args) {
		System.out.println(getBean("export.db.driver"));
	}

}
